package D1112;

public class Test01 {
    public static void main(String[] args) {
        //同一种对象
        Person p1=new Student();
        System.out.println(p1.name);//多态下 成员变量的编译和运行都看左边
        p1.say();

        if(p1 instanceof  Student){
            Student stu2=(Student)p1;
            stu2.playGame();
        }

        Person p2=new Teacher();//多态下 成员变量的编译和运行都看左边
        p2.say();
    }
}
